package bbb.aaa;

import java.util.List;

import bbb.BallInfo;
import bbb.BallMap;

public class SelectorMatcher {

	public static void blueSelectorMatch(Selector selector){
		int begin = 100;
		int count = 0;
		while(begin < 900){
			BallInfo bi = BallMap.ballAt(begin);
			List<BallInfo> lb = BallMap.ballBefore(begin);
			List<BallInfo> ll = selector.select(lb);
			
			System.out.print(bi.getCode()+":");
			for(BallInfo bll : ll){
				System.out.print(bll.getBlue());
				if(bi.getBlue().equals(bll.getBlue())){
					count++;
					System.out.print(":中奖");
				}else{
					System.out.print(":未中奖");
				}
			}
			System.out.println();
			begin++;
		}
		
		System.out.println("========================================");
		System.out.println("中奖数量："+count);
	}
	
	public static void match(Selector selector){
		int begin = 100;
		int count = 0;
		while(begin < 900){
			BallInfo bi = BallMap.ballAt(begin);
			List<BallInfo> lb = BallMap.ballBefore(begin);
			List<BallInfo> ll = selector.select(lb);
			
			System.out.print(bi.getCode()+":");
			for(BallInfo bll : ll){
				System.out.print(bll.getBlue());
				if(bi.getBlue().equals(bll.getBlue())){
					count++;
					System.out.print(":中奖");
				}else{
					System.out.print(":未中奖");
				}
			}
			System.out.println();
			begin++;
		}
		
		System.out.println("========================================");
		System.out.println("中奖数量："+count);
	}
	
	public static void main(String[] args) {
		BallMap.loadData("C:\\Users\\Administrator\\Desktop\\双色球\\r.txt");
		BlueSelector selector = new BlueSelector();
		selector.setCount(1);
		SelectorMatcher.blueSelectorMatch(selector);
	}
}
